﻿using System;
using System.Collections;
using System.Collections.Generic;

using Castle.Services.Transaction;
using Castle.Facilities.IBatisNetIntegration;

using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class SchoolStuReportLogic : CommonLogic<SchoolStuReport, int>, ISchoolStuReportLogic
    {
        #region Implementation of ICommonLogic<SchoolStuReport, int>

        /// <sammury>
        /// 创建对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(SchoolStuReport entity)
        {
            return CreateObject(entity);
        }

        /// <sammury>
        /// 更新对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(SchoolStuReport entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public int Delete(int entityId)
        {
            return DeleteObject(entityId);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll()
        {
            return DeleteAllObject();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public SchoolStuReport FindById(int entityId)
        {
            return FindObjectById(entityId);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount()
        {
            return FindObjectByCount();
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<SchoolStuReport> FindAll()
        {
            return FindAllObject();
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<SchoolStuReport> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion

        /// <summary>
        /// 考生前x名，后x名成绩查询报表 
        /// </summary>
        /// <param name="examId">考试id</param>
        /// <param name="schoolMark">学校编号</param>
        /// <param name="condition">排序条件，desc还是asc</param>
        /// <param name="indexNum">名次，前几名后几名</param>
        /// <param name="subjectCondition">科目查询条件"and subjectId=46"</param>
        /// <returns></returns>
        public IList<SchoolStuReport> SelectStuSchoolPositionReport(int examId, string schoolMark, string condition, int indexNum, string subjectCondition)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("condition", condition);
            table.Add("rowNum", indexNum);
            table.Add("subjectCondition", subjectCondition);
            table.Add("sign", "<=");

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuSchoolPositionReport", table);
        }
        /// <summary>
        /// 学生模糊查询 前x名，后x名成绩查询报表  
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="schoolMark"></param>
        /// <param name="stuSelectInfo"></param>
        /// <returns></returns>
        public IList<SchoolStuReport> SelectStuSchoolPositionReportEx(int examId, string schoolMark, string stuSelectInfo)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("stuSelectInfo", stuSelectInfo);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuSchoolPositionReportEx", table);
        }




        /// <summary>
        /// 考生高于X分，低于X分的成绩查询报表
        /// </summary>
        /// <param name="examId">考试id</param>
        /// <param name="schoolMark">学校编号</param>
        /// <param name="condition">排序条件，desc还是asc</param>
        /// <param name="indexNum">名次，前几名后几名</param>
        /// <param name="subjectCondition">科目查询条件"and subjectId=46"</param>
        /// <returns></returns>
        public IList<SchoolStuReport> SelectStuSchoolScoreReport(int examId, string schoolMark, string sign, int indexNum, string subjectCondition)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("rowNum", indexNum);
            table.Add("subjectCondition", subjectCondition);
            table.Add("sign", sign);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuSchoolScoreReport", table);
        }
        public IList<SchoolStuReport> SelectStuSchoolScoreReportEx(int examId, string schoolMark, string stuSelectInfo)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("stuSelectInfo", stuSelectInfo);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuSchoolScoreReportEx", table);
        }

        /// <summary>
        /// 学校统考考生前x名，后x名成绩查询报表 
        /// </summary>
        /// <param name="examId">考试id</param>
        /// <param name="schoolMark">学校编号</param>
        /// <param name="condition">排序条件，desc还是asc</param>
        /// <param name="indexNum">名次，前几名后几名</param>
        /// <returns></returns>
        public IList<SchoolStuReport> SelectStuEduPositionReport(int examId, string schoolMark, string condition, int indexNum, string subjectCondition,string scoreName)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("condition", condition);
            table.Add("rowNum", indexNum);
            table.Add("subjectCondition", subjectCondition);
            table.Add("sign", "<=");
            table.Add("scoreName", scoreName);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuEduPositionReport", table);
        }
        public IList<SchoolStuReport> SelectStuEduPositionReportEx(int examId, string schoolMark, string stuSelectInfo, string scoreName)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("stuSelectInfo", stuSelectInfo);
            table.Add("scoreName", scoreName);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuEduPositionReportEx", table);
        }

        /// <summary>
        /// 学校统考考生高于X分，低于X分的成绩查询报表
        /// </summary>
        /// <param name="examId">考试id</param>
        /// <param name="schoolMark">学校编号</param>
        /// <param name="condition">排序条件，desc还是asc</param>
        /// <param name="indexNum">名次，前几名后几名</param>
        /// <param name="subjectCondition">科目查询条件"and subjectId=46"</param>
        /// <returns></returns>
        public IList<SchoolStuReport> SelectStuEduScoreReport(int examId, string schoolMark, string sign, int indexNum, string subjectCondition,string scoreName)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("rowNum", indexNum);
            table.Add("subjectCondition", subjectCondition);
            table.Add("sign", sign);
            table.Add("scoreName", scoreName);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuEduScoreReport", table);
        }
        public IList<SchoolStuReport> SelectStuEduScoreReportEx(int examId, string schoolMark, string stuSelectInfo, string scoreName)
        {
            Hashtable table = new Hashtable();
            table.Add("examId", examId);
            table.Add("SchoolMark", schoolMark);
            table.Add("stuSelectInfo", stuSelectInfo);
            table.Add("scoreName", scoreName);

            return FindCustomer<SchoolStuReport>("SchoolStuReport.SelectStuEduScoreReportEx", table);
        }
        
    }
}
